#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main()
{
    int N = 0;

    scanf("%d", &N);
    getchar();
    while (N--)
    {

        char str[101] = { 0 };
        scanf("%s", str);
        getchar();
        int len = strlen(str);
        if (len < 8)
        {
            printf("NO\n");
            continue;
        }

        if (isdigit(str[0]))
        {
            printf("NO\n");
            continue;
        }

        int arr[3] = { 0 };
        for (int i = 0; i < len; i++)
        {

            if (islower(str[i]))
                arr[0] = 1;
            else if (isdigit(str[i]))
                arr[1] = 1;
            else if (isupper(str[i]))
                arr[2] = 1;

        }

        if (arr[0] + arr[1] + arr[2] >= 2)
            printf("YES\n");
        else
            printf("NO\n");

    }
    return 0;
}


#include <stdlib.h>
int* findErrorNums(int* nums, int numsSize, int* returnSize)
{

    int* arr = (int*)malloc(8);
    int temp[10001] = { 1 };

    for (int i = 0; i < numsSize; i++)
    {
        temp[nums[i]]++;
    }

    for (int i = 0; i < numsSize + 1; i++)
    {
        if (temp[i] == 0)
        {
            arr[1] = i;
        }
        if (temp[i] == 2)
        {
            arr[0] = i;
        }
    }

    *returnSize = 2;
    return arr;
}


